ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
ME.h File Reference

Mode Entry Module The ME controls the device mode and mode transition sequences in all functional states. It also contains configuration, control and status registers accessible for the application. More...

#include "derivative.h"

Go to the source code of this file.

Defines

#define TRUE   (1u)
#define CLEAR   (0u)
#define BITS_IN_NIBBLE   (4u)
#define BITS_IN_BYTE   (8u)
#define BYTES_IN_16   (2u)
#define BYTES_IN_32   (4u)
#define BIT_DEFINITION
#define BIT0   (1u << 0u)
#define BIT1   (1u << 1u)
#define BIT2   (1u << 2u)
#define BIT3   (1u << 3u)
#define BIT4   (1u << 4u)
#define BIT5   (1u << 5u)
#define BIT6   (1u << 6u)
#define BIT7   (1u << 7u)
#define BIT8   (1u << 8u)
#define BIT9   (1u << 9u)
#define BIT10   (1u << 10)
#define BIT11   (1u << 11)
#define BIT12   (1u << 12)
#define BIT13   (1u << 13)
#define BIT14   (1u << 14)
#define BIT15   (1u << 15)
#define BIT16   (1u << 16)
#define BIT17   (1u << 17)
#define BIT18   (1u << 18)
#define BIT19   (1u << 19)
#define BIT20   (1u << 20)
#define BIT21   (1u << 21)
#define BIT22   (1u << 22)
#define BIT23   (1u << 23)
#define BIT24   (1u << 24)
#define BIT25   (1u << 25)
#define BIT26   (1u << 26)
#define BIT27   (1u << 27)
#define BIT28   (1u << 28)
#define BIT29   (1u << 29)
#define BIT30   (1u << 30)
#define BIT31   (1u << 31)
#define ME_TRANSITION   (ME.GS.B.S_MTRANS)
#define ME_REGULATOR_READY   (ME.GS.B.S_MVR)
#define MAX_PERIPH_INDEX_POSSIBLE   (144u)
#define MAX_PERIPH_CONFIG_POSSIBLE   (0x80u)
#define ME_DSPI0   (4u)
#define ME_DSPI1   (5u)
#define ME_DSPI2   (6u)
#define ME_DSPI3   (7u)
#define ME_FLEXCAN0   (16u)
#define ME_FLEXRAY0   (24U)
#define ME_SAFETYPORT   (26u)
#define ME_ADC0   (32u)
#define ME_ADC1   (33u)
#define ME_CTU0   (35u)
#define ME_ETIMER0   (38u)
#define ME_ETIMER1   (39U)
#define ME_PWM0   (41u)
#define ME_LINFLEX0   (48U)
#define ME_LINFLEX1   (49u)
#define ME_PIT   (92u)
#define RUN_ALWAYS_ON   (PERIPH_ALWAYS_ON)
#define RUN_ALWAYS_OFF   (PERIPH_ALWAYS_OFF)
#define LP_ALWAYS_ON   (PERIPH_ALWAYS_ON << 3u)
#define LP_ALWAYS_OFF   (PERIPH_ALWAYS_OFF << 3u)
#define DEBUG_FREEZE_ON   (0x40u)
#define DEBUG_FREEZE_OFF   (0x00u)
#define STOP0_DISABLED   (0x00000000u)
#define STOP0_ENABLED   (0x00000400u)
#define HALT0_DISABLED   (0x00000000u)
#define HALT0_ENABLED   (0x00000100u)
#define RUN3_DISABLED   (0x00000000u)
#define RUN3_ENABLED   (0x00000080u)
#define RUN2_DISABLED   (0x00000000u)
#define RUN2_ENABLED   (0x00000040u)
#define RUN1_DISABLED   (0x00000000u)
#define RUN1_ENABLED   (0x00000020u)
#define TEST_DISABLED   (0x00000000u)
#define TEST_ENABLED   (0x00000002u)
#define PDO_OFF   (0x00000000u)
#define PDO_ON   (0x00800000u)
#define MVRON_OFF   (0x00000000u)
#define MVRON_ON   (0x00100000u)
#define DATA_FLASH_OFF   (0x00040000u)
#define DATA_FLASH_LP   (0x00080000u)
#define DATA_FLASH_ON   (0x000C0000u)
#define CODE_FLASH_OFF   (0x00010000u)
#define CODE_FLASH_LP   (0x00020000u)
#define CODE_FLASH_ON   (0x00030000u)
#define PLL1_OFF   (0x00000000u)
#define PLL1_ON   (0x00000080u)
#define PLL0_OFF   (0x00000000u)
#define PLL0_ON   (0x00000040u)
#define XOSC0_OFF   (0x00000000u)
#define XOSC0_ON   (0x00000020u)
#define IRC_16MHZ_OFF   (0x00000000u)
#define IRC_16MHZ_ON   (0x00000010u)
#define SYSCLK_IS_IRC   (0x00000000u)
#define SYSCLK_IS_XOSC   (0x00000002u)
#define SYSCLK_IS_PLL0   (0x00000004u)
#define SYSCLK_IS_PLL1   (0x00000005u)
#define SYSCLK_IS_OFF   (0x0000000Fu)
#define CHANGE_MODE_KEY_1   (0x00005AF0u)
#define CHANGE_MODE_KEY_2   (0x0000A50Fu)
#define SWITCH_MODE_TIMEOUT   ((uint16_t)0x1000u)
#define ME_HW_NOT_READY   ((uint8_t)BIT0)
#define ME_INVALID_INDEX   ((uint8_t)BIT1)
#define ME_INVALID_RUN_MODE   ((uint8_t)BIT2)
#define ME_OP_MODE_CHANGE_DIDNT_OCCUR   ((uint8_t)BIT3)

Enumerations

enum  ME_VALID_OP_MODES {
  RESET_MODE = 0, TEST_MODE, SAFE_MODE, DRUN_MODE,
  RUN0_MODE, RUN1_MODE, RUN2_MODE, RUN3_MODE,
  HALT0_MODE, RESERVED_MODE, STOP0_MODE
}
enum  ME_PERIPHERAL_PRESETS { PERIPH_ALWAYS_ON = 0, PERIPH_ALWAYS_OFF }

Functions

uint8_t u8fnInitDefaultPeripheralPresets (void)
 Loads default configuration for peripheral behavior in different power situations (namely RUN, low power and debug).
uint8_t u8fnConfigPeripheralForMCUModePreset (const uint8_t u8PeripheralIndex, const uint8_t u8ConfigurationIndex)
 Ties in together a peripheral with a configuration.
uint8_t u8fnCurrentOperationMode (void)
 Returns the current operation mode as described by ME_VALID_OP_MODES.
uint8_t u8fnInitDefaultOpModes (void)
 Configures operation modes according to cau32RunModeConfig, cu32Halt0ModeConfig, and cu32Stop0ModeConfig.
uint8_t u8fnSwitchOpModes (const uint8_t u8Mode)
 Switches from the current operation mode to another one as indicated by the passed argument.

Detailed Description

Mode Entry Module The ME controls the device mode and mode transition sequences in all functional states. It also contains configuration, control and status registers accessible for the application.

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
R11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint8_t u8fnConfigPeripheralForMCUModePreset ( const uint8_t  u8PeripheralIndex,
const uint8_t  u8ConfigurationIndex 
)

Ties in together a peripheral with a configuration.

Parameters:
None
Returns:
Clear if successful, ME_INVALID_INDEX if passed arguments are out of spec.
uint8_t u8fnCurrentOperationMode ( void  )

Returns the current operation mode as described by ME_VALID_OP_MODES.

Parameters:
None
Returns:
Operation mode as described by ME_VALID_OP_MODES
uint8_t u8fnInitDefaultOpModes ( void  )

Configures operation modes according to cau32RunModeConfig, cu32Halt0ModeConfig, and cu32Stop0ModeConfig.

Parameters:
None
Returns:
CLEAR if everything went ok; ME_HW_NOT_READY if in the middle of a transition (command didn't take), or ME_INVALID_RUN_MODE if current mode is not DRUN_MODE.
uint8_t u8fnInitDefaultPeripheralPresets ( void  )

Loads default configuration for peripheral behavior in different power situations (namely RUN, low power and debug).

Parameters:
None
Returns:
Clear if successful, ME_HW_NOT_READY if there's another operation going on.
Note:
Current implementation only allows for solutions as described in enum ME_PERIPHERAL_PRESETS.
uint8_t u8fnSwitchOpModes ( const uint8_t  u8Mode)

Switches from the current operation mode to another one as indicated by the passed argument.

Parameters:
u8Mode,:Next operation mode index as described by ME_VALID_OP_MODES
Returns:
CLEAR if everything went ok; ME_OP_MODE_CHANGE_DIDNT_OCCUR if we timed-out.